import Link from 'next/link'
import { cn } from '@/lib/utils'
import { LinkProps } from 'next/link'
import { ButtonHTMLAttributes } from 'react'

interface ButtonLinkProps extends LinkProps {
  variant?: 'primary' | 'secondary' | 'outline' | 'ghost'
  size?: 'sm' | 'md' | 'lg'
  className?: string
  disabled?: boolean
  children: React.ReactNode
}

export default function ButtonLink({
  className,
  variant = 'primary',
  size = 'md',
  href,
  disabled = false,
  children,
  ...props
}: ButtonLinkProps) {
  const classes = cn(
    'inline-flex items-center justify-center rounded-md font-medium transition-colors',
    'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
    {
      'bg-primary-600 text-white hover:bg-primary-700': variant === 'primary',
      'bg-gray-100 text-gray-900 hover:bg-gray-200': variant === 'secondary',
      'border border-gray-300 bg-transparent hover:bg-gray-100': variant === 'outline',
      'hover:bg-gray-100': variant === 'ghost',
      'h-8 px-3 text-sm': size === 'sm',
      'h-10 px-4': size === 'md',
      'h-12 px-6 text-lg': size === 'lg',
      'pointer-events-none opacity-50': disabled,
    },
    className
  )

  if (disabled) {
    return (
      <span className={classes}>
        {children}
      </span>
    )
  }

  return (
    <Link href={href} className={classes} {...props}>
      {children}
    </Link>
  )
} 